<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/4/11
  Time: 19:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!--分页标签 -->
<%@ taglib prefix="page" uri="/xianzhiOA/pageTag" %>
<!--权限标签-->
<%@ taglib prefix="p" uri="/xianzhiOA/powerTag" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <!-- Basic -->
    <meta charset="UTF-8"/>
    <title>员工一览</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <link href="${pageContext.request.contextPath}/dist/backEnd/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="${pageContext.request.contextPath}/dist/backEnd/css/style.css" rel="stylesheet"/>
    <link href="${pageContext.request.contextPath}/dist/backEnd/css/skycons.css" rel="stylesheet"/>
    <link href="${pageContext.request.contextPath}/dist/backEnd/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="${pageContext.request.contextPath}/dist/backEnd/css/pace.preloader.css" rel="stylesheet"/>
    <link href="${pageContext.request.contextPath}/dist/backEnd/css/jquery.mmenu.css" rel="stylesheet"/>
    <script type="application/javascript"
            src="${pageContext.request.contextPath}/dist/backEnd/js/jquery-2.1.1.min.js"></script>
    <script type="application/javascript">
        function pToSub(page) {
            if (page != undefined) {
                var pageInp = document.getElementById("page");
                pageInp.value = page;
                var form = document.getElementById("empForm");
                form.submit();
            }
        }
        //         添加的单击事件（跳到添加页面的功能）
        function ToAddEmpPage() {
            var empForm = document.getElementById("empForm");
            empForm.action = "${pageContext.request.contextPath}/XzEmp/ToAddEmpPage.emp";
        }
        function deleteCheck(empId) {
            if (confirm("确定要删除吗？")) {
                var empForm = document.getElementById("empForm");
                window.location.href = "${pageContext.request.contextPath}/XzEmp/deleteEmp.emp?empId=" + empId;
            }
        }
    </script>
</head>
<body>
<!--头部开始-->
<jsp:include page="headerBack.jsp"></jsp:include>
<!-- 导航 -->
<jsp:include page="leftBack.jsp"></jsp:include>
<!--内容页-->
<div class="main">
    <!--内容页头部-->
    <div class="page-header">
        <div class="pull-left">
            <ol class="breadcrumb visible-sm visible-md visible-lg">
                <li><a href="two.html"><i class="icon fa fa-home"></i>主页</a></li>
                <li class="active"><i class="fa fa-pencil"></i>基本信息</li>
            </ol>
        </div>
        <div class="pull-right">
            <h2>主页</h2>
        </div>
    </div>
    <form action="${pageContext.request.contextPath}/XzEmp/selEmpAll.emp" class="search1" id="empForm" method="post">
        <div>
            <p:power jspPower="员工管理：添加">
            <div>
                <%--<button type="submit" class="two btn btn-primary" style="float: left"  onclick="ToAddEmpPage()">添加</button>--%>
                <button type="submit" class="three btn btn-primary" onclick="ToAddEmpPage()">添加</button>
                <a href="${pageContext.request.contextPath}/XzEmp/selEmpAll.emp" class="three btn btn-primary">重置</a>
            </div>
            </p:power>
            <div style="margin-top: 10px">
                <input id="page" name="page" type="hidden" value="${page}">
                <input id="pages" name="pages" type="hidden" value="${pages}">
                <input type="text" placeholder="姓名..." name="empName" value="${Emp.empName}">
                <%--<input type="text" placeholder="角色..." name="empRole" value="${Emp.empRole}">--%>
                <select name="empRole">
                    <option  value="0">—请选择查询条件—</option>
                    <c:forEach items="${RoleList}" var="r">
                        <c:if test="${r.roleId != 1}">
                            <option value="${r.roleId}" name="${Emp.role.roleId}" <c:if test="${Emp.empRole==r.roleId}">selected="selected"</c:if>>${r.roleName}</option>
                        </c:if>
                    </c:forEach>
                </select>
                <input type="text" placeholder="电话..." name="empTel" value="${Emp.empTel}">
                <input type="text" placeholder="员工账户..." name="empAccount" value="${Emp.empAccount}">
                <button type="submit" class="one"><span class="fa fa-search"></span></button>
            </div>

        </div>
        <!--表格-->
        <div class="well">
            <table class="table" id="now">
                <thead>
                <tr>
                    <th class="d">员工工号</th>
                    <th class="d">姓名</th>
                    <th class="d">角色</th>
                    <th class="d">电话</th>
                    <th class="d">员工账户</th>
                    <th class="d">员工密码</th>
                    <p:power jspPower="员工管理：修改">
                        <th class="dd">修改</th>
                    </p:power>
                    <p:power jspPower="员工管理：删除">
                        <th class="dd">删除</th>
                    </p:power>
                    <p:power jspPower="员工管理：考勤">
                        <th class="dd">考勤</th>
                    </p:power>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="Emp" items="${EmpList}">
                    <tr>
                        <td style="display: none">${Emp.empId}</td>
                        <td>${Emp.empNo}</td>
                        <td>${Emp.empName}</td>
                        <%--<td>${Emp.empRole}</td>--%>
                        <td>${Emp.role.roleName}</td>
                        <td>${Emp.empTel}</td>
                        <td>${Emp.empAccount}</td>
                        <td>${Emp.empPwd}</td>
                        <p:power jspPower="员工管理：修改">
                        <td><a href="${pageContext.request.contextPath}/XzEmp/editEmp.emp?empId=${Emp.empId}"><i
                                class="fa fa-pencil"></i></a></td>
                        <!-- <td><a href="${pageContext.request.contextPath}/XzEmp/deleteEmp.emp?empId=${Emp.empId}" role="button" data-toggle="modal"><i class="fa fa-times"></i></a></td>  -->
                        </p:power>
                        <p:power jspPower="员工管理：删除">
                        <td><a onclick="deleteCheck(${Emp.empId})" role="button" data-toggle="modal"><i
                                class="fa fa-times"></i></a></td>
                        </p:power>
                        <p:power jspPower="员工管理：考勤">
                        <td>
                            <a href="${pageContext.request.contextPath}/XzAttendanceStateRecord/selectAll.emp?empNo=${Emp.empNo}"
                               role="button" data-toggle="modal"><i class="fa fa-flag"></i></a></td>
                        </p:power>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
        <!--分页符-->
        <div style="float: right">
            <ul class="pagination">
                <page:paging length="10" page="${page}" pages="${pages}"/>
            </ul>
        </div>
    </form>
</div>
</body>
</html>
